package cn.gson.crm.controller.student;

import java.util.List;
import java.util.Map;

import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.alibaba.fastjson.JSONArray;

import cn.gson.crm.controller.BaseServlet;
import cn.gson.crm.model.dao.GraduateDao;

/**
 * 处理查看毕业生联系记录的ajax
 */
@WebServlet("/student/checkrecordAjax")
public class CheckRecordAjaxServlet extends BaseServlet {
	private static final long serialVersionUID = 1L;
	private GraduateDao graduateDao = new GraduateDao();

	protected void get(HttpServletRequest request, HttpServletResponse response) throws Exception {
		String sid = request.getParameter("sid");
		List<Map<String, Object>> data = graduateDao.getAllGraduateRecordById(sid);
		response.setContentType("application/json;charset=utf-8");
		// 把结果转换成JSON字符串
		String jsonStr = JSONArray.toJSONString(data);
		// 输出结果
		response.getWriter().append(jsonStr);

	}

}
